package com.aygxy.carproject.search.task;

import com.aygxy.carproject.search.service.SearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时加载数据库Spu数据到ES
 */
@Component
@Slf4j
public class LoadSpuTask {
    @Autowired
    private SearchService searchService;

    @Scheduled(cron = " 0 0 * * * * ")
    public void executeScheduleTask(){
        log.info("开始定时更新数据到ES");
        searchService.loadSpuByPage();
        log.info("加载数据完毕！！");
    }

}
